.class final Lnet/tsapps/topdeals/views/f;
.super Ljava/lang/Object;

# interfaces
.implements Landroid/widget/AdapterView$OnItemClickListener;


# instance fields
.field private synthetic a:Lnet/tsapps/topdeals/views/TdDealList;


# direct methods
.method constructor <init>(Lnet/tsapps/topdeals/views/TdDealList;)V
    .locals 0

    iput-object p1, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public final onItemClick(Landroid/widget/AdapterView;Landroid/view/View;IJ)V
    .locals 8

    const/16 v6, 0x14

    const/4 v2, 0x1

    const/4 v3, 0x0

    iget-object v0, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-static {v0}, Lnet/tsapps/topdeals/views/TdDealList;->a(Lnet/tsapps/topdeals/views/TdDealList;)Ljava/util/ArrayList;

    move-result-object v0

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v0

    if-lt p3, v0, :cond_0

    iget-object v0, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-static {v0}, Lnet/tsapps/topdeals/views/TdDealList;->b(Lnet/tsapps/topdeals/views/TdDealList;)Landroid/view/View$OnClickListener;

    move-result-object v0

    const/4 v1, 0x0

    invoke-interface {v0, v1}, Landroid/view/View$OnClickListener;->onClick(Landroid/view/View;)V

    :goto_0
    return-void

    :cond_0
    new-instance v5, Landroid/content/Intent;

    iget-object v0, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-virtual {v0}, Lnet/tsapps/topdeals/views/TdDealList;->getContext()Landroid/content/Context;

    move-result-object v0

    const-class v1, Lnet/tsapps/topdeals/DetailActitivty;

    invoke-direct {v5, v0, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    new-instance v4, Ljava/util/ArrayList;

    invoke-direct {v4}, Ljava/util/ArrayList;-><init>()V

    iget-object v0, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-static {v0}, Lnet/tsapps/topdeals/views/TdDealList;->a(Lnet/tsapps/topdeals/views/TdDealList;)Ljava/util/ArrayList;

    move-result-object v0

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v0

    if-gt v0, v6, :cond_1

    iget-object v0, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-static {v0}, Lnet/tsapps/topdeals/views/TdDealList;->a(Lnet/tsapps/topdeals/views/TdDealList;)Ljava/util/ArrayList;

    move-result-object v0

    move v1, v3

    move v2, v3

    :goto_1
    const-string v4, "deallist"

    invoke-virtual {v5, v4, v0}, Landroid/content/Intent;->putParcelableArrayListExtra(Ljava/lang/String;Ljava/util/ArrayList;)Landroid/content/Intent;

    const-string v0, "prevdealsexist"

    invoke-virtual {v5, v0, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;

    const-string v0, "furtherdealsexist"

    invoke-virtual {v5, v0, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;

    const-string v1, "itemid"

    iget-object v0, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-static {v0}, Lnet/tsapps/topdeals/views/TdDealList;->a(Lnet/tsapps/topdeals/views/TdDealList;)Ljava/util/ArrayList;

    move-result-object v0

    invoke-virtual {v0, p3}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lnet/tsapps/topdeals/objects/Deal;

    iget-wide v6, v0, Lnet/tsapps/topdeals/objects/Deal;->a:J

    invoke-virtual {v5, v1, v6, v7}, Landroid/content/Intent;->putExtra(Ljava/lang/String;J)Landroid/content/Intent;

    const-string v0, "mode"

    iget-object v1, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-static {v1}, Lnet/tsapps/topdeals/views/TdDealList;->c(Lnet/tsapps/topdeals/views/TdDealList;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v5, v0, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    iget-object v0, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-virtual {v0}, Lnet/tsapps/topdeals/views/TdDealList;->getContext()Landroid/content/Context;

    move-result-object v0

    check-cast v0, Landroid/app/Activity;

    invoke-virtual {v0, v5, v3}, Landroid/app/Activity;->startActivityForResult(Landroid/content/Intent;I)V

    goto :goto_0

    :cond_1
    iget-object v0, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-static {v0}, Lnet/tsapps/topdeals/views/TdDealList;->a(Lnet/tsapps/topdeals/views/TdDealList;)Ljava/util/ArrayList;

    move-result-object v0

    iget-object v1, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-static {v1}, Lnet/tsapps/topdeals/views/TdDealList;->a(Lnet/tsapps/topdeals/views/TdDealList;)Ljava/util/ArrayList;

    move-result-object v1

    invoke-virtual {v1, p3}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/util/ArrayList;->indexOf(Ljava/lang/Object;)I

    move-result v0

    iget-object v1, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-static {v1}, Lnet/tsapps/topdeals/views/TdDealList;->a(Lnet/tsapps/topdeals/views/TdDealList;)Ljava/util/ArrayList;

    move-result-object v1

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    sub-int/2addr v1, v0

    if-lt v1, v6, :cond_2

    iget-object v1, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-static {v1}, Lnet/tsapps/topdeals/views/TdDealList;->a(Lnet/tsapps/topdeals/views/TdDealList;)Ljava/util/ArrayList;

    move-result-object v1

    add-int/lit8 v6, v0, 0x13

    invoke-virtual {v1, v0, v6}, Ljava/util/ArrayList;->subList(II)Ljava/util/List;

    move-result-object v0

    move v1, v2

    :goto_2
    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v6

    :goto_3
    invoke-interface {v6}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-nez v0, :cond_3

    move-object v0, v4

    goto :goto_1

    :cond_2
    iget-object v0, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-static {v0}, Lnet/tsapps/topdeals/views/TdDealList;->a(Lnet/tsapps/topdeals/views/TdDealList;)Ljava/util/ArrayList;

    move-result-object v0

    iget-object v1, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-static {v1}, Lnet/tsapps/topdeals/views/TdDealList;->a(Lnet/tsapps/topdeals/views/TdDealList;)Ljava/util/ArrayList;

    move-result-object v1

    invoke-virtual {v1}, Ljava/util/ArrayList;->size()I

    move-result v1

    add-int/lit8 v1, v1, -0x14

    iget-object v6, p0, Lnet/tsapps/topdeals/views/f;->a:Lnet/tsapps/topdeals/views/TdDealList;

    invoke-static {v6}, Lnet/tsapps/topdeals/views/TdDealList;->a(Lnet/tsapps/topdeals/views/TdDealList;)Ljava/util/ArrayList;

    move-result-object v6

    invoke-virtual {v6}, Ljava/util/ArrayList;->size()I

    move-result v6

    invoke-virtual {v0, v1, v6}, Ljava/util/ArrayList;->subList(II)Ljava/util/List;

    move-result-object v0

    move v1, v3

    goto :goto_2

    :cond_3
    invoke-interface {v6}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lnet/tsapps/topdeals/objects/Deal;

    invoke-virtual {v4, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_3
.end method
